package com.ybwh.springboot1.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.ybwh.springboot1.conf.intercepter.login.LoginRequired;
import com.ybwh.springboot1.model.po.EmployeeAppInfo;
import com.ybwh.springboot1.model.vo.DataTabelPageVo;
import com.ybwh.springboot1.service.AppInfoService;

@LoginRequired
@Controller
@RequestMapping("/app")
public class AppInfoController {

	@Autowired
	private AppInfoService appInfoService;

	@RequestMapping("/list")
	public ModelAndView p_msgConf() {
		ModelAndView mv = new ModelAndView("/app/list");
		return mv;

	}

	@RequestMapping("/pageList")
	@ResponseBody
	public DataTabelPageVo<EmployeeAppInfo> pageList(
			@RequestParam(value = "employeeId", required = false) Integer employeeId,
			@RequestParam(required = false, defaultValue = "0") int start,
			@RequestParam(required = false, defaultValue = "10") int length) {

		Map<String, Object> param = new HashMap<>();

		if (null != employeeId) {
			param.put("employeeId", employeeId);
		}
	

		DataTabelPageVo<EmployeeAppInfo> pageData = appInfoService.pageList(param, start, length);
		return pageData;

	}

}
